<template>
  <div style="width:100%;height:100%;overflow:hidden">
    <weui-cell :list="cell_0_list">
    </weui-cell>
  </div>
</template>

<script>
  import WeuiCell from '../vue2componentSet/src/components/WeuiCell'
  import global from '../lib/global'
  import axios from 'axios'

  export default {
    components: {
      WeuiCell
    },
    data() {
      return {
        cell_0_list: []
      }
    },
    mounted() {
      this.$store.commit('set_title', '访问统计')

      if (!this.$store.state.admin) {
        this.$router.goback()
        return
      }

      axios.post(global.server + 'getLogData.do', {}).then(result => {
        const obj = result.data
        var cnt = 0
        obj.data.forEach(item => {
          cnt += item.count
        })
        this.cell_0_list.push({
          value: '全部',
          desc: cnt,
          link: '#/customerLog?customer_phone=*'
        })
        obj.data.forEach(item => {
          this.cell_0_list.push({
            value: item.customer_phone,
            desc: item.count,
            link: '#/customerLog?customer_phone=' + item.customer_phone
          })
        })
      }, result => {
      })
    }
  }
</script>
